<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE AllowAmbiguousTypes
           , FunctionalDependencies
           , KindSignatures
           , MultiParamTypeClasses
           , PolyKinds
  #-}</span><span>
</span><span id="line-7"></span><span>
</span><span id="line-8"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Module      :  GHC.Records</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Copyright   :  (c) Adam Gundry 2015-2016</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Portability :  non-portable (GHC extensions)</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- This module defines the 'HasField' class used by the</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- @OverloadedRecordFields@ extension.  See the</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- &lt;https://gitlab.haskell.org/ghc/ghc/wikis/records/overloaded-record-fields</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- wiki page&gt; for more details.</span><span>
</span><span id="line-22"></span><span class="hs-comment">--</span><span>
</span><span id="line-23"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Records</span><span>
</span><span id="line-26"></span><span>       </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Records.html#HasField"><span class="hs-identifier">HasField</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span>       </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-comment">-- | Constraint representing the fact that the field @x@ belongs to</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- the record type @r@ and has field type @a@.  This will be solved</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- automatically, but manual instances may be provided as well.</span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-comment">--   HasField :: forall {k}. k -&gt; * -&gt; * -&gt; Constraint</span><span>
</span><span id="line-34"></span><span class="hs-comment">--   getField :: forall {k} (x::k) r a. HasField x r a =&gt; r -&gt; a</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- NB: The {k} means that k is an 'inferred' type variable, and</span><span>
</span><span id="line-36"></span><span class="hs-comment">--     hence not provided in visible type applications.  Thus you</span><span>
</span><span id="line-37"></span><span class="hs-comment">--     say     getField @&quot;foo&quot;</span><span>
</span><span id="line-38"></span><span class="hs-comment">--     not     getField @Symbol @&quot;foo&quot;</span><span>
</span><span id="line-39"></span><span class="hs-keyword">class</span><span> </span><span id="HasField"><span class="annot"><a href="GHC.Records.html#HasField"><span class="hs-identifier hs-var">HasField</span></a></span></span><span> </span><span id="local-6989586621679565266"><span class="annot"><a href="#local-6989586621679565266"><span class="hs-identifier hs-type">x</span></a></span></span><span> </span><span id="local-6989586621679565265"><span class="annot"><a href="#local-6989586621679565265"><span class="hs-identifier hs-type">r</span></a></span></span><span> </span><span id="local-6989586621679565264"><span class="annot"><a href="#local-6989586621679565264"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="#local-6989586621679565266"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679565265"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679565264"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-40"></span><span>  </span><span class="hs-comment">-- | Selector function to extract the field from the record.</span><span>
</span><span id="line-41"></span><span>  </span><span id="getField"><span class="annot"><a href="GHC.Records.html#getField"><span class="hs-identifier hs-type">getField</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679565265"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679565264"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-42"></span></pre></body></html>